package com.glory.hikvisionmobile.activity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;

import com.glory.hikvisionmobile.R;
import com.glory.hikvisionmobile.base.BaseActivity;
import com.glory.hikvisionmobile.base.Constant;
import com.glory.hikvisionmobile.customView.HikWebView;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.model.Response;
import com.pda.platform.ui.ui_pdaplatform.callback.FreeUI_EntityCallBack;
import com.pda.platform.ui.ui_pdaplatform.entity.FreeUI_AddViewEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_NetUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_Utils;

import butterknife.BindView;

/**
 * *****************************
 *
 * @Anthor yazhou
 * @Email 1184545990@qq.com
 * @Time 2020/3/11 18:39
 * @DESC *****************************
 */
public class SopFileActivity extends BaseActivity {

    @BindView(R.id.llMain)
    LinearLayout llMain;
    @BindView(R.id.hikWebView)
    HikWebView hikWebView;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_sop_file;
    }

    @Override
    protected void initView() {
        hikWebView.setDownloadListener((url, userAgent, contentDisposition, mimetype, contentLength) -> {
            Bundle bundle = new Bundle();
            bundle.putString("filePath",url);
            bundle.putString("fileName","");
            FreeApi_Utils.skipWithExtraIntent("header",bundle,this, SopPdfActivity.class);
        });
    }

    @Override
    protected void initData() {
        hikWebView.loadUrl("http://10.197.132.30/file/");

//        FreeApi_NetUtils.requestGetNet("http://10.197.132.30/file/", this, null, new FreeUI_EntityCallBack<Object>(new TypeToken<Object>() {}.getType()) {
//
//            @Override
//            public void onSuccess(Response<Object> response) {
//                Log.i(SopFileActivity.class.getSimpleName(), response.body().toString());
//            }
//        });
    }

    @Override
    protected FreeUI_AddViewEntity getBaseEntity() {
        freeUI_titleView.setTitle("SOP文件");

        return new FreeUI_AddViewEntity("header", llMain);
    }

}
